##1.
# # str=input('请输入一串字符串')
# # en=0
# # num=0
# # sp=0
# # other=0
# #
# # for cha in str:
# #     if cha.isalpha():
# #         en+=1
# #     elif cha.isnumeric():
# #         num+=1
# #     elif cha.isspace():
# #         sp+=1
# #     else:
# #         other+=1
# # print('英文有{}个，数字{}个，空格有{}个，其他有{}个'.format(en,num,sp,other))
#2.
# from random import *
# guess = randint(0, 9)
# count=0
# while 1:
#     chese = input("请输入0-9之间的整数:")
#     if chese.isdigit():
#         if int(chese) == guess:
#             print("猜对了")
#             count+=1
#             break
#         elif int(chese) > guess:
#             print("猜大了")
#             count += 1
#         elif int(chese) < guess:
#             print("猜小了")
#             count += 1
#     else:
#         break
#
# print('你猜了{}次'.format(count))

try:
    num=eval(input('请输入一个整数'))
    print(num**2)
except :
    print('错误')
else:
    print('没有错误')
finally:
    print('dead')

from functools import reduce


def str2num(s):
    try:
        return float(s)
    except:
        return int(s)


def calc(exp):
    ss = exp.split('+')
    ns = map(str2num, ss)
    return reduce(lambda acc, x: acc + x, ns)


def main():
    r = calc('100+200+345')
    print('100+200+345=', r)
    r = calc('99+88+7.6')
    print('99+88+7.6', r)


main()